package com.akexiu.springcloud.weather.controller;

import com.akexiu.springcloud.weather.service.WeatherDataService;
import com.akexiu.springcloud.weather.vo.WeatherResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/weather")
public class WeatherDataController {
    @Autowired
    public WeatherDataService weatherDataService;


    /**
     * @deprecated:
     * @param cityId:
     * @return: com.akexiu.springcloud.weather.vo.WeatherResponse
     * @exception/throws:
     * @author: 5
     * @date:   2021/8/4
     */
    @GetMapping("/cityId/{cityId}")
    public WeatherResponse getWeatherByCityId(@PathVariable("cityId") String cityId) {
        return weatherDataService.getDataByCityId(cityId);
    }

    @GetMapping("/cityName/{cityName}")
    public WeatherResponse getWeatherByCityName(@PathVariable("cityName") String cityName) {
        return weatherDataService.getDataByCityName(cityName);
    }



}
